<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>字符串的表示方式 | </title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="./chapter02.html" />
    
    
    <link rel="prev" href="./index.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="1"
        data-chapter-title="字符串的表示方式"
        data-filepath="chapter01.md"
        data-basepath="."
        data-revision="Tue Feb 04 2020 11:24:25 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                
                        <i class="fa fa-check"></i>
                        
                        学习目标
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="1" data-path="chapter01.html">
            
                
                    <a href="./chapter01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        字符串的表示方式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="chapter02.html">
            
                
                    <a href="./chapter02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        字符串的下标和切片
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3" data-path="chapter03.html">
            
                
                    <a href="./chapter03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        字符串的常见操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="chapter04.html">
            
                
                    <a href="./chapter04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        字符集和编码
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="chapter05.html">
            
                
                    <a href="./chapter05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        成员运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="chapter06.html">
            
                
                    <a href="./chapter06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        字符串的format方法
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" ></a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h2 id="&#x5B57;&#x7B26;&#x4E32;&#x4ECB;&#x7ECD;">&#x5B57;&#x7B26;&#x4E32;&#x4ECB;&#x7ECD;</h2>
<p>&#x5B57;&#x7B26;&#x4E32;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x4E00;&#x6BB5;&#x666E;&#x901A;&#x7684;&#x6587;&#x672C;&#x5185;&#x5BB9;&#xFF0C;&#x5728;python&#x91CC;&#xFF0C;&#x4F7F;&#x7528;&#x5F15;&#x53F7;&#x6765;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x4E0D;&#x540C;&#x7684;&#x5F15;&#x53F7;&#x8868;&#x793A;&#x7684;&#x6548;&#x679C;&#x4F1A;&#x6709;&#x533A;&#x522B;&#x3002;</p>
<h3 id="&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;&#x65B9;&#x5F0F;">&#x5B57;&#x7B26;&#x4E32;&#x8868;&#x793A;&#x65B9;&#x5F0F;</h3>
<pre><code class="lang-python">    a = <span class="hljs-string">&quot;I&apos;m Tom&quot;</span>  <span class="hljs-comment"># &#x4E00;&#x5BF9;&#x53CC;&#x5F15;&#x53F7; </span>
    b = <span class="hljs-string">&apos;Tom said:&quot;I am Tom&quot;&apos;</span>  <span class="hljs-comment"># &#x4E00;&#x5BF9;&#x5355;&#x5F15;&#x53F7;</span>
    c = <span class="hljs-string">&apos;Tom said:&quot;I\&apos;m Tom&quot;&apos;</span>  <span class="hljs-comment"># &#x8F6C;&#x4E49;&#x5B57;&#x7B26;</span>
    d = <span class="hljs-string">&apos;&apos;&apos;Tom said:&quot;I&apos;m Tom&quot;&apos;&apos;&apos;</span>  <span class="hljs-comment"># &#x4E09;&#x4E2A;&#x5355;&#x5F15;&#x53F7;</span>
    e = <span class="hljs-string">&quot;&quot;&quot;Tom said:&quot;I&apos;m Tom&quot; &quot;&quot;&quot;</span>  <span class="hljs-comment"># &#x4E09;&#x4E2A;&#x53CC;&#x5F15;&#x53F7;</span>
</code></pre>
<p>&#x5C0F;&#x603B;&#x7ED3;&#xFF1A;</p>
<ul>
<li>&#x53CC;&#x5F15;&#x53F7;&#x6216;&#x8005;&#x5355;&#x5F15;&#x53F7;&#x4E2D;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x5C31;&#x662F;&#x5B57;&#x7B26;&#x4E32;</li>
<li>&#x5982;&#x679C;&#x4F7F;&#x7528;&#x4E00;&#x5BF9;&#x5F15;&#x53F7;&#x6765;&#x5B9A;&#x4E49;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5F53;&#x51FA;&#x73B0;&#x7B26;&#x53F7;&#x51B2;&#x7A81;&#x65F6;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8F6C;&#x4E49;&#x5B57;&#x7B26;</li>
<li>&#x4F7F;&#x7528;&#x4E09;&#x4E2A;&#x5355;&#x5F15;&#x53F7;&#x3001;&#x53CC;&#x5F15;&#x53F7;&#x5B9A;&#x4E49;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x53EF;&#x4EE5;&#x5305;&#x88F9;&#x4EFB;&#x610F;&#x6587;&#x672C;</li>
</ul>
<h3 id="&#x8F6C;&#x4E49;&#x5B57;&#x7B26;">&#x8F6C;&#x4E49;&#x5B57;&#x7B26;</h3>
<p>&#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#x662F;&#x5F88;&#x591A;&#x7A0B;&#x5E8F;&#x8BED;&#x8A00;&#x3001;&#x6570;&#x636E;&#x683C;&#x5F0F;&#x548C;&#x901A;&#x4FE1;&#x534F;&#x8BAE;&#x7684;&#x5F62;&#x5F0F;&#x6587;&#x6CD5;&#x7684;&#x4E00;&#x90E8;&#x5206;&#xFF0C;&#x4F7F;&#x7528;<code>\</code>&#x6765;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#x3002;&#x5E38;&#x89C1;&#x7684;&#x8F6C;&#x4E49;&#x5B57;&#x7B26;&#x4EE5;&#x53CA;&#x5B83;&#x6240;&#x4EE3;&#x8868;&#x7684;&#x542B;&#x4E49;&#x5982;&#x4E0B;&#x8868;:</p>
<table>
<thead>
<tr>
<th style="text-align:center">&#x8F6C;&#x4E49;&#x5B57;&#x7B26;</th>
<th style="text-align:center">&#x542B;&#x4E49;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">\r</td>
<td style="text-align:center">&#x5C06;&#x5F53;&#x524D;&#x4F4D;&#x7F6E;&#x79FB;&#x5230;&#x672C;&#x884C;&#x5F00;&#x5934;</td>
</tr>
<tr>
<td style="text-align:center">\n</td>
<td style="text-align:center">&#x5C06;&#x5F53;&#x524D;&#x4F4D;&#x7F6E;&#x79FB;&#x5230;&#x4E0B;&#x4E00;&#x884C;&#x5F00;&#x5934;</td>
</tr>
<tr>
<td style="text-align:center">\t</td>
<td style="text-align:center">&#x7528;&#x6765;&#x8868;&#x793A;&#x4E00;&#x4E2A;&#x5236;&#x8868;&#x7B26;</td>
</tr>
<tr>
<td style="text-align:center"><code>\\</code></td>
<td style="text-align:center">&#x4EE3;&#x8868;&#x4E00;&#x4E2A;&#x53CD;&#x659C;&#x7EBF;&#x5B57;&#x7B26;<code>\</code></td>
</tr>
<tr>
<td style="text-align:center">\&apos;</td>
<td style="text-align:center">&#x7528;&#x6765;&#x663E;&#x793A;&#x4E00;&#x4E2A;&#x5355;&#x5F15;&#x53F7;</td>
</tr>
<tr>
<td style="text-align:center">\&quot;</td>
<td style="text-align:center">&#x7528;&#x6765;&#x663E;&#x793A;&#x4E00;&#x4E2A;&#x53CC;&#x5F15;&#x53F7;</td>
</tr>
</tbody>
</table>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="./index.html" class="navigation navigation-prev " aria-label="Previous page: 学习目标"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./chapter02.html" class="navigation navigation-next " aria-label="Next page: 字符串的下标和切片"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
